package com.lei.session.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.lei.session.dao.PermissionDao;
import com.lei.session.entity.Permission;
import com.lei.sqlJsp.dao.Impl.JDBC;

public class PermissionDaoImpl implements PermissionDao {

	@Override
	public List<Permission> listAll() {
		Connection conn = JDBC.getConn();
		String sql = "select * from t_permission t where t.user_name=user";
		PreparedStatement ps = null;
		List<Permission> list = new ArrayList();
		ResultSet rs = null;
		try {
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			while (rs.next()) {
				int i = 1;
				Long id = rs.getLong(i++);
				String userName = rs.getString(i++);
//				String permissionNumber=rs.getString(i++);
//				String permissionName=rs.getString(i++);
//				Date creationTime=rs.getTimestamp(i++);
//				String deleteLog=rs.getString(i++);
				list.add(new Permission());
			}
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			JDBC.close(null, ps, conn);
		}
		return null;
	}

}
